package com.lingjtx.common.pay.common;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public enum PaySceneEnum {

    APP(1),
    H5(2),
    MINI_PROGRAM(3),
    QR_CODE(4);

    private final int code;

    PaySceneEnum(int code) {
        this.code = code;
    }

    @JsonValue
    public int getCode() {
        return code;
    }

    @JsonCreator
    public static PaySceneEnum fromCode(int code) {
        for (PaySceneEnum value : values()) {
            if (value.code == code) {
                return value;
            }
        }
        throw new IllegalArgumentException("Invalid PaySceneEnum code: " + code);
    }
}
